package com.baidu.controller;

import com.baidu.service.UploadSrvice;
import com.baidu.utils.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 满天星斗
 * @version 1.0
 * @description: TODO
 * @date 2021/8/18 17:54
 */
@RestController
@CrossOrigin(origins = "*",allowedHeaders = "*")
public class UploadController {

    @Autowired
    private UploadSrvice uploadSrvice;

    @PostMapping("/upload")
    public ResultResponse upload(HttpServletRequest request){
        return  uploadSrvice.upload(request);
    }

    @PostMapping("/delFile")
    public ResultResponse delFile(String  filename){
        return  uploadSrvice.delFile(filename);
    }

    @PostMapping("/downLoadFile")
    public ResultResponse downLoadFile(String  filename){
        return  uploadSrvice.downLoadFile(filename);
    }

}
